package com.qyer.search.threading;/**
 * User: Z J Wu Date: 2016/01/04 Time: 17:04 Package: com.qyer.search.threading
 */

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.ForkJoinPool;

public class SearchingThreadPoolHolder extends AbstractThreadPoolHolder {

  private static final Logger LOGGER = LoggerFactory.getLogger(SearchingThreadPoolHolder.class);

  private static class InnerHolder {

    private static final SearchingThreadPoolHolder INSTANCE = new SearchingThreadPoolHolder();
  }

  private SearchingThreadPoolHolder() {
    LOGGER.info("Search-Query thread pool has been built.");
    this.service = new ForkJoinPool(100);
    this.name = "SEARCH-QUERY-FORK-JOIN-POOL";
  }

  public static final SearchingThreadPoolHolder getInstance() {
    return InnerHolder.INSTANCE;
  }

  public ForkJoinPool getForkService() {
    return (ForkJoinPool) getService();
  }

}
